package com.lam.schedule.listener;

import com.lam.common.components.easyexcel.imp.listener.BaseListener;
import com.lam.common.components.easyexcel.imp.model.ImportWrapper;
import com.lam.schedule.entity.ScheduleJob;
import com.lam.schedule.entity.imp.ScheduleJobImp;
import com.lam.schedule.service.ScheduleJobService;

/**
 * 定时调度导入读取类 
 * 此类不能单例，要每次读取excel都要new 
 * @author admin
 *
 */
public class UploadScheduleJobListener extends BaseListener<ScheduleJobImp, ScheduleJob> {
	
	private ScheduleJobService scheduleJobService;

	public UploadScheduleJobListener(ScheduleJobService scheduleJobService) {
		super(ScheduleJobImp.class, ScheduleJob.class);
		this.scheduleJobService = scheduleJobService;
	}

	//重新该方法可自定义校验数据
//	@Override
//	protected String checkData(ImportEntry<ScheduleJobImp, ScheduleJob> wrapper) {
//		//自定义校验数据逻辑
//		return null;
//	}

	@Override
	protected void saveSuccessData(ImportWrapper<ScheduleJobImp, ScheduleJob> wrapper) {
		
		scheduleJobService.importData(wrapper);
	}


}
